package data;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Stroke;

/**
 * DarwingSettings is a singleton class which is used to store some settings for
 * drawing, such color, fill color, eraser size etc.
 * 
 * @author Jie Zhao(288654)
 * 
 */
public class DrawingSettings {
	private Color filledColor = null;
	private boolean isFilled = false;
	private BasicStroke stroke = null;
	private Color lineColor = null;
	private Stroke eraserSize = null;
	private Color canvasBackground = null;

	private static DrawingSettings instance = null;

	/**
	 * @return an instance of drawing settings
	 */
	public static DrawingSettings getInstance() {
		if (instance == null) {
			instance = new DrawingSettings();
		}
		return instance;
	}

	private DrawingSettings() {
		filledColor = Color.WHITE;
		lineColor = Color.BLACK;
		isFilled = false;
		stroke = new BasicStroke(1);
	}

	/**
	 * 
	 * @return filled color
	 */
	public Color getFilledColor() {
		return filledColor;
	}

	/**
	 * Set filled color
	 * 
	 * @param filledColor
	 */
	public void setFilledColor(Color filledColor) {
		this.filledColor = filledColor;
	}

	/**
	 * 
	 * @return true if the shape is filled;false if not
	 */
	public boolean isFilled() {
		return isFilled;
	}

	/**
	 * Set if the shape if filled or not
	 * 
	 * @param isFilled
	 */
	public void setFilled(boolean isFilled) {
		this.isFilled = isFilled;
	}

	/**
	 * @return the stroke currently in use
	 */
	public BasicStroke getStroke() {
		return stroke;
	}

	/**
	 * Set the stroke for shape
	 * 
	 * @param stroke
	 */
	public void setStroke(BasicStroke stroke) {
		this.stroke = stroke;
	}

	/**
	 * 
	 * @return line color
	 */
	public Color getLineColor() {
		return lineColor;
	}

	/**
	 * set line color
	 * 
	 * @param lineColor
	 */
	public void setLineColor(Color lineColor) {
		this.lineColor = lineColor;
	}

	/**
	 * 
	 * @return Eraser Size
	 */
	public Stroke getEraserSize() {
		return eraserSize;
	}

	/**
	 * Set the eraser size
	 * 
	 * @param eraserSize
	 */
	public void setEraserSize(Stroke eraserSize) {
		this.eraserSize = eraserSize;
	}

	/**
	 * 
	 * @return Canvas background
	 */
	public Color getCanvasBackground() {
		return canvasBackground;
	}

	/**
	 * Set canvas background
	 * 
	 * @param canvasBackground
	 */
	public void setCanvasBackground(Color canvasBackground) {
		this.canvasBackground = canvasBackground;
	}
}
